#include "../include/structure.h"


int initPool(pool_t *pool, int num){
    pool->list = (pthread_t *)calloc(num, sizeof(pthread_t));
    pool->num = num;

    // 初始化队列
    memset(&pool->queue, 0, sizeof(pool->queue));

    pthread_mutex_init(&pool->lock, NULL);
    pthread_cond_init(&pool->cond, NULL);
    
    for (int i = 0; i < num; i++){
        pthread_create(&pool->list[i], NULL, threadMain, (void*)pool);
    }
    
    pool->exitFlag = 0;
    return 0;
}

